<template>
	<view class="mywallet_dea" v-if="userinfo">
		<!-- #ifndef H5 -->
		<fui-nav-bar></fui-nav-bar>
		<!-- #endif -->
		<view class="his" @click="his()">
			记录
		</view>
		<view v-if="type==1" class="tp">
			<image src="/static/my/ic_wallet.png"></image>
			<view class="money">
				当前余额
			</view>
			<view  class="m_str">
				<span>￥</span>
				{{userinfo.money}}
			</view>
		</view>
		
		<view v-if="type==2" class="tp">
			<image src="/static/my/ic_box_pay_integral.png"></image>
			<view class="money">
				当前现金积分
			</view>
			<view  class="m_str">
				<span>￥</span>
				{{userinfo.score}}
			</view>
		</view>
		
	
	</view>
</template>

<script>
	export default {
		data() {
			return {
				userinfo:null,
				type:1
			};
		},
		onLoad(ops) {
			
			this.type = ops.type
		},
		onShow(ops) {
			this.get_userinfo();
		},
		methods: {
			his(){
				uni.navigateTo({ url: '/pages/my/my_log?type='+this.type });
			},
			get_userinfo(){
				let that = this;
				uni.showLoading({ title: '正在加载', mask: true });
				uni.hideLoading();
				that.$api.request('/api/user/get_info', {},uni.getStorageSync('token'), function(res) {
								uni.hideLoading()
								if (res.code === 1) {
									that.userinfo = res.data
								} else {
									uni.showToast({
										title: res.msg,
										icon: 'none'
									})
								}
				});
				
			},
			// 导航点击处理
			navClickHandle(item) {
				if (item.url) {
					uni.navigateTo({ url: item.url });
				}
			},

			// 跳转设置
			jumpSetting() {
				uni.navigateTo({
					url: '/pages/settings/settings'
				});
			},

			// 跳转分享页面
			jumpShare() {
				uni.navigateTo({
					url: '/pages/share/share'
				});
			}
		}
	};
</script>

<style lang="scss">
	page {
		background: #fff;
	}
	
	.mywallet_dea{
		
		.his{
			position: fixed;
			float: right;
			top:20rpx;
			font-size: 24rpx;
			z-index: 999;
			right: 20rpx;
		}
		.tp{
			width: 100%;
			text-align: center;
			margin-top: 30rpx;
			image{
				width: 100rpx;
				height: 100rpx;
			}
			.money{
				color: #999;
				font-size: 22rpx;
				margin-top: 20rpx;
			}
			.m_str{
				font-size: 60rpx;
				margin-top: 15rpx;
				font-weight: 700;
				span{
					font-size: 34rpx
				};
			}
		}
		
	}
</style>
